home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
iqb9104.zip
/
LJDEMO2.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-04-05
|
3KB
|
92 lines
' LJDEMO2.BAS--A program demonstrating PCL shaded-box graphics
'
DECLARE SUB BoxString (instr$)
' Print an asterisk at (1200,1500) - the exact center of the page
LPRINT CHR$(27); "*p1200x1500Y"; ' move to (1200,1500)
LPRINT "* (1200,1500)" ' display message
LPRINT CHR$(27); "E" ' eject page
' Print a 2" x 3" shaded box using cross-hatch pattern 4 at (450,450)
LPRINT CHR$(27); "*p450x450Y"; ' move cursor at (450,450)
' set width to 600, and
LPRINT CHR$(27); "*c600a900B"; ' set eight to 900
LPRINT CHR$(27); "*c4G"; ' do cross-hatching pattern 4
LPRINT CHR$(27); "*c3P" ' print shaded box
LPRINT CHR$(27); "E" ' eject page
' Print a 8" x 1/4" bar with 56% shading at (0,2925)
LPRINT CHR$(27); "*p0x2925Y"; ' move cursor at (0,2925)
' set width to 2400, and
LPRINT CHR$(27); "*c2400a75B"; ' set eight to 75
LPRINT CHR$(27); "*c56G"; ' select 56% shading pattern
LPRINT CHR$(27); "*c2P" ' print shaded bar
LPRINT CHR$(27); "E" ' eject page
' Print a black box within a cross-hatch #2 box
' First, do the cross-hatch filled box
LPRINT CHR$(27); "*p300x300Y"; ' move cursor at (300,300)
' set height to 1200, and
LPRINT CHR$(27); "*c1200a1200B"; ' set hwidth to 1200
LPRINT CHR$(27); "*c2G"; ' set cross-hatch pattern 2
LPRINT CHR$(27); "*c3P" ' print shaded box
' Now, do the black box
LPRINT CHR$(27); "*p600x600Y"; ' move cursor at (600,600)
' set height to 600, and
LPRINT CHR$(27); "*c600a600B"; ' set width to 600
' no pattern for black
LPRINT CHR$(27); "*c0P" ' print black box
LPRINT CHR$(27); "E" ' eject page
' Lastly, get a line of text from the user, and print it
' centered in a white box centered inside a 21% shaded box
LINE INPUT "Please enter a line of text >", HeadLine$
BoxString HeadLine$
END
SUB BoxString (Instr$) STATIC
' A general-purpose subprogram to box and center a string
' at the top of a page. Requires a LaserJet III printer.
Border% = 75 ' all borders are 1/4" (75 dots)
CenterOfPage% = 1200 ' center of 8.5" page w/ 1/4" margins
StrWidth% = LEN(Instr$) * 30 ' default font is 30 dots wide
' calculate dimensions and starting point for shaded box
ShadeX% = CenterOfPage% - (Border% * 2) - (StrWidth% / 2)
ShadeY% = 0
ShadeWidth% = (Border% * 4) + StrWidth%
ShadeHeight% = (Border% * 2) + 75
' send escape sequences for shaded box
LPRINT CHR$(27); "*p"; ShadeX%; "x"; ShadeY%; "Y";
LPRINT CHR$(27); "*c"; ShadeWidth%; "a"; ShadeHeight%; "B";
LPRINT CHR$(27); "*c21g2P"
' calculate dimensions for white box inside shaded box
WhiteX% = ShadeX% + Border%
WhiteY% = Border%
WhiteWidth% = (Border% * 2) + StrWidth%
WhiteHeight% = 75
' send escape sequences for white box
LPRINT CHR$(27); "*p"; WhiteX%; "x"; WhiteY%; "Y";
LPRINT CHR$(27); "*c"; WhiteWidth%; "a"; WhiteHeight%; "B";
LPRINT CHR$(27); "*c1P"
' center and print string, then eject page
LPRINT SPACE$(40 - LEN(Instr$) / 2); Instr$
LPRINT CHR$(27); "E"
END SUB